package com.gsafety.libraryktx.expand

import android.widget.EditText
import com.gsafety.library.Exts.Ext
import com.gsafety.library.common.OnTextAfterChangedListener
import com.gsafety.library.common.OnTextBeforeChangedListener
import com.gsafety.library.common.OnTextChangedListener

/**
 * 文字改变之前
 */
inline fun <reified T : EditText> T.beforeTextChanged(listener: OnTextBeforeChangedListener)
{
    Ext.beforeTextChanged(this, listener)
}

/**
 * 文字正在改变
 */
inline fun <reified T : EditText> T.onTextChanged(listener: OnTextChangedListener)
{
    Ext.onTextChanged(this, listener)
}

/**
 * 文字改变之后
 */
inline fun <reified T : EditText> T.onAfterChanged(listener: OnTextAfterChangedListener)
{
    Ext.onAfterChanged(this, listener)
}

/**
 * 清空Edittext的内容
 */
inline fun <reified T : EditText> T.clear()
{
    Ext.clear(this)
}